﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <title></title>
    <style type="text/css">
        body {padding:0;margin:0; width: 100%; height: 100%;background-image:url(Images/appdownload/bg.png);background-size:100% 100%;background-repeat:no-repeat;background-position:left top; -webkit-user-select: none; -webkit-text-size-adjust: none;-webkit-overflow-scrolling: touch;font-size:63%;font-family:Microsoft YaHei; }
        img{border:0;}
        p{padding:0;margin:0;}
        .main{width:80%;height:100%; margin:0 auto;overflow:hidden;}
        .floor{width:100%;height:auto; overflow:hidden;}
        .floor-one{margin-top:10%;text-align:center;}
        .floor-one img{display:block;width:30%;height:auto;margin:0 auto; clear:both;padding-bottom:3vmin;}
        .floor-one p{font-size:3.5vmin;font-weight: normal;color:#fff;text-align:center;line-height:7vmin;}
        .floor-one p.intro{font-size:2.8vmin;text-align:left;line-height:5vmin;}
        @media (min-width: 1280px) {
             .floor-one p.intro{text-align:center;}
        }
        .floor-two{margin:8% 0;}
        .floor-two .qr{width:auto;height:auto; margin:0 auto;width:30%; padding:1.5vmin;background-image:url(Images/appdownload/erweima_tl.png),url(Images/appdownload/erweima_tr.png),url(Images/appdownload/erweima_br.png),url(Images/appdownload/erweima_bl.png);background-position:0 0,100% 0,100% 100%,0 100%;background-repeat:no-repeat; background-size:12%;}
        .floor-two .qr img{display:block;width:100%; height:auto;margin:0 auto;}
        .floor-two a{display:block;width:40%;height:auto;margin:3vmin auto; cursor:pointer;overflow:hidden;clear:both;}
        .floor-two a:first-child{margin-top:20vmin;}
        .floor-two a img{display:block;width:100%;height:auto;}
        .floor-three{margin:0 auto;}
        .content{width:80%;margin:0 auto;border-top:1px solid rgba(255,255,255,0.5);border-bottom:1px solid rgba(255,255,255,0.5);padding:15px 0 25px 0;text-align:center;}
        .content .content_chl{width:auto;height:auto; margin:0 auto;overflow:hidden;padding-left:20%;text-align:left;}
        @media (min-width: 1400px) {
            .content .content_chl{padding-left:30%;}
        }
        .content p{font-size:2.8vmin;color:#fff;font-weight:normal;line-height:5vmin;text-indent:0vmin;}
        .content p.t1{text-align:center;padding:2vmin 0;text-indent:0;}
        .content p.t1 img{vertical-align:middle;padding-right:10px;width:8%;height:auto;}
        .floor-four{text-align:center;padding:4vmin 0;color:#75e9f5;font-size:5vmin;font-family:'Microsoft YaHei';font-weight:normal;}
        #tipdiv{width: 100%; height: 100%; background-color:#000000; background: url('image/trans-bgs.png') repeat; position:absolute;top:0;z-index:10;display:none;}
        #tipdiv-box{width: 100%;height: 100%;background: url('image/tips2.png') no-repeat;background-size: 100%; z-index:10;}
        #frm {position: fixed;z-index:-1;height:1px;width:1px;display:block;}
    </style>
</head>
<body>
    <div id="tipdiv">
        <div id="tipdiv-box"></div>
    </div>
    <div class="main">
        
        <div class="floor floor-one">
            <img src="Images/appdownload/icon.png" />
            <img src="Images/appdownload/logo.png" />
            <p>牌友最喜爱的竞技世界</p>
            <p class="intro">多种玩法可选，自由搭配，满足不同玩家的游戏习惯，最正宗最本地口味</p>
        </div>
        <div id="msg"></div>
        <div class="floor floor-two">
            <div class="qr"><img src="Images/appdownload/fr_k_EW2.png" /></div>
			<a id="start_game" style="margin-top:5vmin;"><img src="Images/appdownload/game_btn.png" /></a>
            <a id="ios_btn" style="margin-top:5vmin;" href="http://jfys.bzw.cn/apk/android/MyLuaGame-release.apk"><img src="Images/appdownload/ios_btn.png" /></a>
            <a id="android_btn" href="http://jfys.bzw.cn/apk/android/MyLuaGame-release.apk"><img src="Images/appdownload/android_btn.png" /></a>
        </div>
        <div class="floor floor-three">
            <div class="content">
                <p class="t1"><img src="Images/appdownload/phone.png" />联系我们</p>
                <div class="content_chl">
                    <p>客服电话：0754-1234567</p>
                    <p>客服邮箱：1234567@163.com</p>
                    <p>商务合作：0754-1234567</p>
                </div>
            </div>
        </div>
        <div class="floor floor-four">
            <i>更多精彩，敬请期待</i>
        </div>
    </div>
    <script>
        //window.history.forward(0);
        (function(){
            console.log("come in!!");
            var config = {
                ad: '',
                scheme_IOS: 'com.boyaa.MahjongKawuxing://?mid=1264245&fid=863119&timestamp=1516073598',
                scheme_Adroid: 'jfapk://com.zyl.tzgame5?mid=1264245&fid=863119&timestamp=1516073598',
                download_IOS: 'http://itunes.apple.com/cn/app/id1070437555',
                download_Adroid: 'http://jfys.bzw.cn/apk/android/MyLuaGame-release.apk',
                timeout1: 300,
                timeout2: 600,
                timeout_d: 1000
            };
            var ua = navigator.userAgent.toLowerCase();
            var isios = false;
            var isweixin = false;
            var isqq = false;
            if (/iphone|ipad|ipod/.test(ua)) {
                isios = true;
            }
            if (/micromessenger/.test(ua)) {
                isweixin = true;
            }
            if (/qq\//.test(ua)) {
                isqq = true;
            }
            var t,t1;
            var hasApp = true;
            var endTime = 0;
            var ifr = document.createElement('iframe');
            function openclient() {
                console.log("openclient in!!");
                setTimeout(function () {
                    clears();
                    if (hasApp) { } else {
                        download();
                    }
                }, config.timeout_d);
                var startTime = +Date.now();
                ifr.setAttribute('id', 'frm');
                ifr.setAttribute('src', (isios === true) ? config.scheme_IOS : config.scheme_Adroid);
                if (isios === true) {
                    alert("this is ios!!");
                    config.timeout1 = 1;
                } else {
                    document.body.appendChild(ifr); //第一种方式
                    document.getElementById("start_game").onclick();
                }
                t = setTimeout(function () {
                    document.getElementById('msg').innerHTML = '检测并打开游戏';
                    if (isios === true) {
                        window.location.href = config.scheme_IOS; //IOS第二种方式
                    }
                    t1 = setTimeout(function () {
                        endTime = +Date.now();
                        if (!startTime || endTime - startTime < config.timeout1 + config.timeout2 + 200) {
                            hasApp = false;
                        } else {
                            download();
                        }
                    }, config.timeout2);
                }, config.timeout1);
                window.onblur = function () {
                    if (endTime > 0) clears();
                };
            }
            /*
            * 打开android app
            */
            function open_android_app(){
                var ifr = document.createElement('iframe');
                ifr.setAttribute('id', 'frm');
                ifr.setAttribute('src', (isios === true) ? config.scheme_IOS : config.scheme_Adroid);
                document.body.appendChild(ifr); //第一种方式
                // window.onblur = function () {
                //     if (endTime > 0) clears();
                // };
            }
            var start_game = document.getElementById("start_game");
            start_game.onclick = open_android_app;

            function clears() {
                console.log("clears in!!");
                clearTimeout(t);
                clearTimeout(t1);
                if (document.body.getElementsByTagName('iframe').length > 0)
                    document.body.removeChild(ifr);
                document.getElementById('msg').innerHTML = config.ad;
            }
            /*
            * 打开阴影遮盖面板,引导用户使用本地浏览器打开网页
            */
            function showopenpage(){
                console.log("clears in!!");
                document.getElementById('tipdiv').style.display = 'block';
                document.getElementById('android_btn').src = 'Images/appdownload/ios_btn.png';
                //     document.getElementById('description2').style.display = 'block';
            }
            function download() {
                console.log("download in!!");
                // document.getElementById('downdiv').style.display = 'block';
                if (isios === true) {
                    document.getElementById('ios_btn').href = config.download_IOS;
                }
                if (isweixin === true || isqq === true) {
                    showopenpage()
                //     document.getElementById('tipdiv').style.display = 'block';
                //     document.getElementById('android_btn').src = 'Images/appdownload/ios_btn.png';
                // //     document.getElementById('description2').style.display = 'block';
                // } else if (!hasApp) {
                    // document.getElementById('description').style.display = 'block';
                }
            }
            
            download();
            openclient();
        })();
    </script>
</body>
</html>
